﻿using BlogApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlogApi.Services
{
    /// <summary>
    /// 文章与文章TAG表的关系表仓储接口
    /// </summary>
    public interface IArticleToArticleTagRepository
    {
        /// <summary>
        /// 获取所有文章TAG与文章关系表的所有数据
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<ArticleToArticleTag>> GetArticleToArticleTagsAsync();
        /// <summary>
        /// 根据关系表的ID获取数据
        /// </summary>
        /// <param name="articleToArticleTagId"></param>
        /// <returns></returns>
        Task<ArticleToArticleTag> GetArticleToArticleTagAsync(Guid articleToArticleTagId);
        /// <summary>
        /// 根据文章ID获取该文章TAG关系表数据
        /// </summary>
        /// <param name="articleId"></param>
        /// <returns></returns>
        Task<IEnumerable<ArticleToArticleTag>> GetArticleToArticleTagsByArticleIdAsync(Guid articleId);
        /// <summary>
        /// 根据TAGID获取所有关系数据
        /// </summary>
        /// <param name="tagId"></param>
        /// <returns></returns>
        Task<IEnumerable<ArticleToArticleTag>> GetArticleToArticleTagsByTagIdAsync(Guid tagId);
        /// <summary>
        /// 根据TAGID获取分页后的关系数据
        /// </summary>
        /// <param name="tagId"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        Task<IEnumerable<ArticleToArticleTag>> GetArticleToArticleTagsByTagIdAsync(Guid tagId, int pageSize, int pageIndex);
        /// <summary>
        /// 新增一个关系
        /// </summary>
        /// <param name="articleToArticleTag"></param>
        void AddArticleToArticleTag(ArticleToArticleTag articleToArticleTag);
        /// <summary>
        /// 更新一个关系数据
        /// </summary>
        /// <param name="articleToArticleTag"></param>
        void UpdateArticleToArticleTag(ArticleToArticleTag articleToArticleTag);
        /// <summary>
        /// 删除一个关系数据
        /// </summary>
        /// <param name="articleToArticleTag"></param>
        void DeleteArticleToArticleTag(ArticleToArticleTag articleToArticleTag);
        /// <summary>
        /// 该关系是否存在
        /// </summary>
        /// <param name="articleToArticleTagId"></param>
        /// <returns></returns>
        Task<bool> ArticleToArticleTagExistsAsync(Guid articleToArticleTagId);
        /// <summary>
        /// 保存更改并更新到数据库
        /// </summary>
        /// <returns></returns>
        Task<bool> SaveAsync();
    }
}
